import {
	upload, uploadHooks
} from './upload'
import {
	getLoginCode
} from '../utils/user'

const http = uni.$u.http
// console.log(http, 'http========');
/**
 * API请求类，封装了各种接口调用
 */
export class Api {
	// 获取登录验证码
	static getLoginCode = getLoginCode
	/**
	 * 上传文件
	 */
	static upload = uploadHooks

	/**
	 * 获取轮播图信息
	 * @param {Object} params 参数对象
	 * @returns 返回轮播图列表的数据
	 */
	static swiper = () => http.get(`/app-api/app/swiper/list`)

	/**
	 * 获取注册验证码
	 * @param {Object} data 包含验证码发送所需信息的对象
	 * @returns 返回请求结果
	 */
	static getRegisterCode = (data) => http.post('/app-api/user/auth/douYin-mini-app-login', data)

	/**
	 * 获取导航栏信息
	 * @param {Object} params 参数对象
	 * @returns 返回导航栏列表的数据
	 */
	static getNavbar = (params) => http.get('/app-api/app/navbar/getList', {
		params
	})

	/**
	 * 获取充值信息
	 * @param {Object} params 参数对象，用于分页和筛选
	 * @returns 返回充值页面的数据
	 */
	static getRecharge = (params) => http.get('/app-api/member/recharge/page', {
		params
	})

	/**
	 * 获取会员金币详情的数据
	 * @param {Object} params 参数对象
	 * @returns 返回会员金币详情的数据
	 */
	static getMember = (params) => http.get('/app-api/member/bean-detail/page', {
		params
	})

	/**
	 * 获取用户金币信息
	 * @param {Object} params 参数对象
	 * @returns 返回用户金币信息
	 */
	static getUserBean = (params) => http.get('/app-api/member/user/getUserBean', {
		params
	})

	/**
	 * 获取用户现金余额
	 * @param {Object} params 参数对象
	 * @returns 返回用户现金余额
	 */
	static getUserMoney = (params) => http.get('/app-api/member/user/getUserMoney', {
		params
	})

	/**
	 * 更新用户信息
	 * @param {Object} data 包含要更新的用户信息的对象
	 * @returns 返回更新用户信息的结果
	 */
	static updateUserInfo = (data) => http.put('/app-api/member/user/update', data)

	/**
	 * 获取用户信息
	 * @param {Object} params 参数对象
	 * @returns 返回用户信息的数据
	 */
	static refreshToken = (refreshToken) => http.post(`/app-api/user/auth/refresh-token?refreshToken=${refreshToken}`)

	/**
	 * 添加投诉信息
	 */
	static addComplaint = (data) => http.post('/app-api/member/complaint/create', data)

	/**
	 * 获取app配置
	 */
	static getAppConfig = (params) => http.get('/app-api/app/app/getConfig', {
		params
	})
	/**
	 * 创建订单
	 */
	static createOrder = (data) => http.post('/app-api/member/recharge/makeRecharge', data)
	/**
	 * 支付成功回调
	 */
	static PayCallBack = (data) => http.post('/app-api/member/recharge/PayCallBack', data)

	/*
	 * 支付配置
	 * */
	static getPayConfig = (data) => http.post('/app-api/app/pay-config/pay', data)
	/**
	 * v3支付签名
	 */
	static paySign = (data) => http.post('/app-api/app/pay-config/pay_sign', data)
	/**
	 * 微信拉取支付获取签名
	 */
	static wxGetPaySign = (data) => http.post('/app-api/app/pay-config/pay', data)
	/**
	 * app签到列表
	 */
	static getSignList = () => http.get('/app-api/app/signin-config/getSigninConfigList')

	/**
	 * 签到
	 */
	static signIn = () => http.get('/app-api/member/sign-detail/signIn')
	/**
	 * 查询签到状态
	 */
	static getSignInTodayStatus = () => http.get('/app-api/member/sign-detail/getSignInTodayStatus')
	/**
	 * 获取观看短剧奖励列表
	 */
	static getAwardListByLottery = () => http.get('/app-api/ad/award/awardListByLottery')
	/**
	 * 获取广告签到奖励
	 */
	static getAwardListBySignIn = () => http.get('/app-api/ad/award/awardListBySignIn')
	// 创建广告记录
	static advertisementCreate = (data) => http.post('/app-api/ad/detail/create', data)
	// 分类获取用户广告观看记录
	static getAdSurplusDetail = () => http.get('/app-api/ad/detail/getAdSurplusDetail')
	// 获取首页热剧分页
	static getAppTvPageList = (params) => http.get('/app-api/tv/tv/page', {
		params
	})
	// 获得短剧推荐列表
	static getRecommendTv = (size) => http.get('/app-api/tv/tv/getRecommendTv?size=' + size)
	// 获取我的喜欢列表
	static getMyLikePageList = (params) => http.get('/app-api/member/like/page', {
		params
	})
	// 获取视频链接
	static getMediaLink = (params) => http.get('/app-api/tv/listmedia/getMediaLink', {
		params
	})
	// 获取首页排行榜
	static getRankList = () => http.get('/app-api/tv/tv/getRankList')
	// 获取充值模版
	static getRechargeList = (params) => http.post('/app-api/app/recharge-template/get', params)
	// 获取是否自动解锁下一集
	static updateAutoplay = (params) => http.get('/app-api/member/user/updateAutoplay', {
		params
	})
	// 更新排行榜视频链接
	static updateSeriesWxVideo = (params) => http.post('/app-api/tv/series-wx/updateSeriesWxVideo', {
		params
	})
	// 获取推荐视频数据
	static getWatchPage = (params) => http.post('/app-api/tv/series-app/getWatchPage',params)
	// 更新喜欢状态
	static likeTvUpdate = (params) => http.post('/app-api/member/like/appLikeTv',
		params
	)
	// 获取选集数据
	static anthology = (params) => http.post('/app-api/tv/series-dy/anthology',
		params
	)
	// 获取短剧信息
	static getTvInfo = (data) => http.post('/app-api/tv/tv/get', data)
	// 获取剧集数据
	static getPageByTvId = (params) => http.post('/app-api/tv/series-app/getPageByTvId',
		params
	)
	// 付费金币解锁
	static paySeriesMember = (params) => http.post('/app-api/member/had-apy/paySeries',
		params
	)
	// 挽留支付接口
	static detainmentGet = (data) => http.post('/app-api/app/detainment/get', data)
	// 记录用户观看记录
	static getMemberAdd = (params) => http.post('/app-api/member/history/add',
		params
	)
	// 获取首页用户观看历史
	static getMemberLIst = () => http.get('/app-api/member/history/index_user_data')
	// 观看历史分页
	static getHistoryList = (params) => http.get('/app-api/member/history/getHistoryList', {
		params
	})
	// 用户记录观看记录明细
	static historyItemCreated = (params) => http.post('/app-api/member/history-item/dy-create',
		params
	)
	// 记录用户看完记录
	static updateFinishState = (id) => http.get('/app-api/member/history-item/updateFinishState?id=' + id)
	// 删除用户看剧记录
	static historyDel = (id) => http.get('/app-api/member/history/del?id=' + id)
	// 获取用户观看历史集数
	static getHistory = (id) => http.get('/app-api/member/history/getHistory?id=' + id)
	// 订阅短剧
	static userSubscription = (data) => http.post('/app-api/member/subscription/userSubscription',
		data
	)
	// 获取年费充值模板
	static getYearLIst = () => http.get('/app-api/app/recharge-template/getYear')
	// 获取追剧列表
	static getFollowTvList = (params) => http.get('/app-api/member/follow-tv/page', {
		params
	})
	// 添加追剧
	static followUserPost = (data) => http.post('/app-api/member/follow-tv/follow', data)
	// 删除追剧记录
	static followUserDel = (id) => http.get('/app-api/member/follow-tv/del?id=' + id)
	//获取金券记录
	static getTicketList = (params) => http.get('/app-api/member/ticket/page', {
		params
	})
	// 查询广告次数
	static getTvConfigNum = (params) => http.get('/app-api/ad/tv-config/get', {
		params
	})
	// 查询分销用户信息
	static getDistributionInfo = () => http.get('/app-api/member/user/getDistributionInfo')
	// 获得用户金额记录分页
	static getMoneyPage = (params) => http.get('/app-api/member/money-detail/page', {
		params
	})
	// 获得我的团队分页
	static getSubordinatePage = (params) => http.get('/app-api/member/money-detail/subordinatePage', {
		params
	})
	// 查询分销用户信息
	static getCardData = () => http.get('/app-api/member/money-detail/getCardData')
	// 获取分销配置
	static getDistribution = () => http.get('/app-api/app/distribution/get')
	//绑定上级
	static bindParent = (params) => http.get('/app-api/member/user/bindParent', {
		params
	})
	static getDistributionTeamCardData = () => http.get('/app-api/member/money-detail/getDistributionTeamCardData')
	// 获取分享二维码
	static getTvQrCode = (params) => http.get('/app-api/tv/tv/getTvQrCode', {
		params
	})
	// 获取提现账号信息
	static getAlipayInfo = () => http.get('/app-api/member/user/getAlipayInfo')
	// 提现
	static withdraw = (data) => http.post('/app-api/member/money-detail/withdraw',
		data
	)
	// 获得tab数据
	static classifyList = (data) => http.get('/app-api/tv/classify/list', data)

	// 获得短剧分类简易列表
	static classifyListSimple = (data) => http.get('/app-api/tv/classify/list-simple', data)

	// 获取短剧第一集的vid
	static getTvFirstVid = (tvId) => http.get('/app-api/tv/series-dy/getTvFirstVid?tvId=' + tvId)

	// 获得站内信模版分页
	static notifyPage = (params) => http.get('/app-api/system/notify-template/page',{
		params
	})

	// 获得提现模版
	static getWithdrawList = () => http.get('/app-api/member/withdraw-template/getList')

	// 提现
	static withdrawDeposit = (data) => http.post('/app-api/member/money-detail/withdrawDeposit', data)

	// 获得短剧点赞追剧详情
	static getTvLikeAndFollow = (data) => http.post('/app-api/tv/tv/getTvLikeAndFollow', data)

	// 发送评论
	static createComment = (data) => http.post('/app-api/member/comment/create', data)

	// 获得短剧顶级评论分页
	static commentPage = (data) => http.get('/app-api/member/comment/page', {
		data
	})

	// 获得短剧多级评论
	static commentParentPage = (data) => http.get('/app-api/member/comment/parent-page', {
		data
	})

	// 金币提现金额
	static conversion = (number) => http.get('/app-api/member/bean-detail/conversion?number='+ number)

	// 热播榜
	static hotList = () => http.get('/app-api/tv/tv/hotList')

	// 飙升榜
	static upList = () => http.get('/app-api/tv/tv/upList')

	// 新剧榜
	static newList = () => http.get('/app-api/tv/tv/newList')

	// 获得活动
	static activity = (type) => http.get('/app-api/app/activity/get?type='+ type)
}
